package com.hrt.manage.member.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hrt.bean.HRTMember;
import com.hrt.manage.member.dao.HRTMemberDao;
import com.hrt.manage.member.service.HRTMemberService;
@Service
public class HRTMemberServiceImpls implements HRTMemberService {
	@Autowired
	private HRTMemberDao hrtMemberDao;
	public HRTMemberServiceImpls() {
	}
	@Override
	public Long totalCount() {
		return hrtMemberDao.totalCount();
	}

	@Override
	public void deleteById(Long[] ids) throws Exception {
		List<HRTMember> members=hrtMemberDao.getByIds(ids);
		for(HRTMember member:members)
		{
			member.setIsdelete(new Integer(1));
			hrtMemberDao.updateEntity(member);
		}
		
	}

	@Override
	public void saveMember(HRTMember hrtMember) throws Exception {
		hrtMemberDao.saveEntity(hrtMember);
		
	}

	@SuppressWarnings("rawtypes")
	@Override
	public List queryByPage(int pageIndex, int pageSize) {
		List list=new ArrayList();
		 list=hrtMemberDao.queryByPage(pageIndex, pageSize);
		return list;
	}

	@Override
	public void updateMember(HRTMember hrtMember) {
		try {
			hrtMemberDao.updateEntity(hrtMember);
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}

	@Override
	public HRTMember getMemberByid(Long memberId) {
		return hrtMemberDao.getById(memberId);
	}
	/* 
	 * 根据会员名称查找会员实体
	 */
	@Override
	public HRTMember getMemberByName(String name) {
		return hrtMemberDao.queryByName(name);
	}
	
	/**查询成功注册的会员*/
	@Override
	public List<HRTMember> searchDelHRTMember() {
		return this.hrtMemberDao.findDelHRTMember();
	}
	
	/**
	 * 按id查询实体
	 * */
	@Override
	public HRTMember getById(Long id) {
		
		return this.hrtMemberDao.getById(id);
	}


}
